<template>
	<view class="shop_collect">
		<u-navbar title="订单信息" @rightClick="rightClick" :autoBack="true">
		</u-navbar>
		<view class="hot_list">
			<!-- <view class="hot_tab" v-for="item in this.hotList">
				<view class="tab_img" @click="jumpDetial(item.item_id)">
					<image :src="item.item_img" mode="aspectFill"></image>
				</view>
				<view class="tab_txt">
					<view class="txt_title">{{item.item_shops}}</view>
					<view class="txt_price">￥{{item.item_price}}</view>
				</view>
			</view> -->
			<view class="hot_tab" v-for="item in colList">
				<view class="tab_img" @click="jumpDetial(item.item_id)">
					<image :src="item.img" mode="aspectFill"></image>
				</view>
				<view class="tab_txt">
					<view class="txt_title">{{item.item_shops}}</view>
					<view class="txt_price">{{item.price}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				colList: []
			};
		},
		async onShow() {
			await this.getColList()
		},

		methods: {
			getColList() {
				uniCloud.callFunction({
					name: "user_all_collect",
					data: {
						uid: uni.getStorageSync("_id")
					}
				}).then(res => {
					console.log(res.result)
					this.colList = res.result
				})
			},
			jumpDetial(sid) {
				console.log(sid);


				uni.setStorageSync("sid", sid)
				uni.removeStorageSync("flat")
				uni.navigateTo({
					url: `/pages/detail/detail?sid=${sid}&flat=0`
				})
			},
		}
	}
</script>

<style lang="scss">
	.shop_collect {
		background-color: #f3f2f2;
		min-height: 100vh;
	}

	.hot_list {
		margin: 60px 20px 0;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;

		.hot_tab {
			background-color: white;
			height: 472rpx;
			width: 326rpx;
			margin-bottom: 20rpx;
			border-radius: 16px;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			overflow: hidden;

			.tab_img {
				height: 364rpx;
				width: 100%;
				background-color: lightblue;
				box-sizing: border-box;
				border: 4px solid white;
				border-radius: 16px 16px 0 0;
				overflow: hidden;

				image {
					height: 100%;
					width: 100%;
				}
			}

			.tab_txt {
				border-top: 1px solid whitesmoke;
				height: 108rpx;
				width: 100%;
				background-color: white;

				.txt_title {
					margin-left: 20rpx;
					margin-top: 10rpx;
					font-size: 16px;
				}

				.txt_price {
					color: #ff78a2;
					margin-left: 20rpx;
					font-size: 14px;

					&::before {
						content: "￥";
						font-size: 12px;
						font-weight: 100;
						margin-right: -5rpx;
					}
				}
			}
		}
	}
</style>